using System;
using System.IO;
using NaughtyAttributes;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace Gj
{
    public class AreaMapLayer : MonoBehaviour
    {
        [Tooltip("Assets目录下的相对路径")] public string path;

        public string[] Indexs;
        public string Namespace;
        public string Bundle;
        public string Variant;

#if UNITY_EDITOR
        [Button("LoadIndex")]
        public void LoadPath()
        {
            if (StringTools.IsEmpty(path)) throw new Exception("Path is empty");
            if (path.Contains("Resources"))
                if (Resource.Settings.AssetBundle)
                {
                }

            var dirs = AssetDatabase.GetSubFolders(Path.Combine("Assets", path));
            // 文件夹作为namespace
            foreach (var d in dirs)
            {
                var name = Path.GetDirectoryName(d);
            }
        }
#endif

        public int GetIndex(string assets)
        {
            return Array.LastIndexOf(Indexs, assets);
        }
    }
}